/*
 * Preferences.java
 * 
 * last update: 14.01.2010 by Stefan Saru
 * 
 * author:	Felix(felix@ulise.cs.pub.ro)
 *
 * Obs: N/A
 */

package ide;
import javax.swing.plaf.metal.DefaultMetalTheme;
import javax.swing.plaf.FontUIResource;
import java.awt.Font;

/**
 * A class to unify the preferences for all he past and future themes.
 * It currently handles only the font type.
 */
class Preferences extends DefaultMetalTheme{

	String defaultFontName = "Fixed";
	int size = 10;
	Font defaultFont = new Font(defaultFontName, Font.PLAIN, size);


	FileHashtable fh;

	public Preferences(FileHashtable fh) {
		this.fh = fh;
		if (!fh.isValid) {      //when a "prefs" file was not found
			System.out.println("prefs file not found.Creating a new one."); 
			//default values:
			fh.put("ControlTextFont", new FontUIResource(defaultFont));
			fh.put("MenuTextFont", new FontUIResource(defaultFont));
			fh.put("SubTextFont", new FontUIResource(defaultFont));
			fh.put("SystemTextFont", new FontUIResource(defaultFont));
			fh.put("UserTextFont", new FontUIResource(defaultFont));
			fh.put("WindowTitleFont", new FontUIResource(defaultFont));
		}   
	}



	public FontUIResource getMenuTextFont(){
		return (FontUIResource)fh.get("MenuTextFont");
		//return new FontUIResource(FontName, Font.PLAIN, size);
	}

	public FontUIResource getControlTextFont(){
		return (FontUIResource)fh.get("ControlTextFont");
		//  return new FontUIResource(FontName, Font.PLAIN, size);
	}

	public FontUIResource getUserTextFont(){
		return (FontUIResource)fh.get("UserTextFont");
		//  return new FontUIResource(FontName, Font.PLAIN, size);
	}

	public FontUIResource getSystemTextFont(){
		return (FontUIResource)fh.get("SystemTextFont");
		//  return new FontUIResource(FontName, Font.PLAIN, size);
	}

	public FontUIResource getSubTextFont(){
		return (FontUIResource)fh.get("SubTextFont");
		//  return new FontUIResource(FontName, Font.PLAIN, size);
	}

	public FontUIResource getWindowTitleFont(){
		return (FontUIResource)fh.get("WindowTitleFont");
		//return new FontUIResource(FontName, Font.PLAIN, size);
	}
}
